import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LotpackageVO, LotpackageForm, LotpackageQuery } from '@/api/access/parking-lot/parking-lot-package/types';

/**
 * 查询套餐管理列表
 * @param query
 * @returns {*}
 */

export const listLotpackage = (query?: LotpackageQuery): AxiosPromise<LotpackageVO[]> => {
  return request({
    url: '/parkinglot/lotPackage/list',
    method: 'get',
    params: query
  });
};
export const listCommonLotpackage = (query?: LotpackageQuery): AxiosPromise<LotpackageVO[]> => {
  return request({
    url: '/parkinglot/lotPackage/commenlist',
    method: 'get',
    params: query
  });
};

/**
 * 查询套餐管理详细
 * @param parkingLotPackageId
 */
export const getLotpackage = (parkingLotPackageId: string | number): AxiosPromise<LotpackageVO> => {
  return request({
    url: '/parkinglot/lotPackage/' + parkingLotPackageId,
    method: 'get'
  });
};

/**
 * 新增套餐管理
 * @param data
 */
export const addLotpackage = (data: LotpackageForm) => {
  return request({
    url: '/parkinglot/lotPackage',
    method: 'post',
    data: data
  });
};

/**
 * 修改套餐管理
 * @param data
 */
export const updateLotpackage = (data: LotpackageForm) => {
  return request({
    url: '/parkinglot/lotPackage',
    method: 'put',
    data: data
  });
};

/**
 * 删除套餐管理
 * @param parkingLotPackageId
 */
export const delLotpackage = (parkingLotPackageId: string | number | Array<string | number>) => {
  return request({
    url: '/parkinglot/lotPackage/' + parkingLotPackageId,
    method: 'delete'
  });
};
